package com.sromku.simple.fb.example;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.example.hal.model.Activite;
import com.example.hal.model.ActiviteController;

public class ActiviteGetAllActivity extends Activity {
private List lists = null;
private List listsName = null;
private ListView listLists;

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.list_activite);

listLists = (ListView) findViewById(R.id.listLists);

getAcitivites();

}

final void getAcitivites() {

ActiviteController list = new ActiviteController();
listsName = new ArrayList();
try {
lists = list.getAllActivites();
} catch (Exception e) {
e.printStackTrace();
}
if (lists != null) {

	 Log.i("GetAllActiviteActivity",String.valueOf(lists.size()));
	 Log.i("GetAllActiviteActivity",lists.get(0).getClass().toString());

	 Log.i("GetAllActiviteActivity",lists.get(0).toString());

for (Object o : lists) {
	Activite u=(Activite) o;
if (u != null)
listsName.add(u.getNom() + " " + u.getLogo());
}

listLists.setAdapter(new ArrayAdapter(getBaseContext(),
android.R.layout.simple_list_item_1, listsName));

listLists.setTextFilterEnabled(true);

}
}
}